#include <string>
#include <iostream>

#include "rocksdb/db.h"
#include "rocksdb/options.h"

using namespace rocksdb;
using namespace std;

// string database_path = "./rocksdb-wikipedia";

int main(int argc, char** argv)
{
    DB *db;
    Options options;

    // Optimize RocksDB. This is the easiest way to get RocksDB to perform well
    options.IncreaseParallelism();
    options.OptimizeLevelStyleCompaction();

    if(argc <= 1){
        cerr << "Usage: see-status DATABASE_PATH\nExample: see-status ./rocksdb-wikipedia\n";
        return -1;
    }

    string database_path = argv[1];
    cout << "status of " << database_path << endl;

    // open DB
    Status s = DB::Open(options, database_path, &db);
    if(!s.ok()) cout << "Open database error!\n" << s.ToString() << endl;


    string res;
    db->GetProperty("rocksdb.dbstats", &res);
    cout << res << endl;

    // db->GetProperty("rocksdb.sstables", &res);
    // cout << res << endl;

    db->GetProperty("rocksdb.cfstats", &res);
    cout << res << endl;

    delete db;
}